<?php
if(!defined('InEmpireCMS'))
{
	exit();
}
?>
<?php
$url="<a href='../../'>首页</a>&nbsp;>&nbsp;<a href='../member/cp/'>控制面板</a>&nbsp;>&nbsp;<a href='ListInfo.php?mid=".$mid."'>管理信息</a>&nbsp;>&nbsp;".$word."&nbsp;(".$mr[qmname].")";
require(ECMS_PATH.'e/data/template/cp_1.php');
?>
<style>
={color:#000;}
textarea{width:590px;height:120px;margin:5px 0px;}
#list{padding:10px 15px;borde11r:1px solid #000;}
#jingdianmiaoshu{width:590px;height:200px;}
#list table tr td .need_title{margin-left:-7px;color:red;padding:5px 2px;width:200px;}
.xheBtnAbout{display:none;}
input{margin:5px;}
.error-text{color:red;font-weight:bold;}
.error-text span{color:blue;padding:0px 10px;}
</style>
<div class="dmain_conent">
	<div class="pageindex">
		<?php if($is_my){
					$theArr=$configApp['my_link'];
				}else{
					$theArr=$configApp['ta_link'];
				}
				//<a class="tips "  href="e/member/uphead/">更新头像</a> 
				if(is_array($theArr)){
					foreach($theArr as $vl){
						echo $vl."\r\n";
			?>		
		<?php 
					}
			} ?>	
	</div>
	<div class='dmini-content'>
	 <form name="add" method="POST" enctype="multipart/form-data" action="ecms.php" onsubmit="EmpireCMSQInfoPostFun(document.add,'<?=$mid?>');">
				<input type="hidden" name="enews" value="<?=$enews?>"  />
				<input type="hidden" name="classid" value="<?=$classid?>" /> 
				<input type="hidden" name="id" id="id" value="<?=$id?>" /> 
				<input type="hidden" name="filepass" value="<?=$filepass?>"  /> 
				<input type="hidden" name="mid"  id="mid" value="<?=$mid?>" />
				<input type="hidden" name="province"  id="hid_province" value="<?=$r['province']?>" />
				<input type="hidden" name="city"  id="hid_city" value="<?=$r['city']?>" />
	  <table><?php
	//var_dump($r);
	  @include($modfile);
	  ?>
	  </table>
	  <div style="align:center;text-align:center;"><input type="submit" class="ok_submit" value="提交"/></div>
	 </form>
	 <script>
	 LoadProvice();
	 var pr= $('#hid_province').val();
	 var ct= $('#hid_city').val()
	// alert(pr);
	$('#slt_province').val(pr);
	$('#slt_province').trigger('change'); 
	// $('#slt_province>option[value='+pr+']').attr('selected');
	if(!pr && !ct){$('#all_city').attr('checked',true)}
	$('#slt_city').val(ct);
	var tags=$('#tags').val();
	var arrTags=tags.split(',');
	//alert(arrTags.length);
	for(var i=0;i<arrTags.length;i++){
		//alert(arrTags[i]);
		//alert('$(.tribe_tags>span>input[value='+$.trim(arrTags[i])+']).length');
		$('.tribe_tags>span>input[value='+$.trim(arrTags[i])+']').eq(0).attr('checked',true);
	}
	setSubmitOk();
	function setSubmitOk(){
					$('.tribe_tags>span>input').click(function(){
						window.tags=[];
						$('.tribe_tags>span>input').each(function(){
							if($(this).attr("checked")){
								window.tags.push($(this).val());
							}
						})
							$("#tags").val(window.tags.toString())						
						});
		 $(".ok_submit").click(function(){
							var title=$("#tribe_title").val();
							var content=$("#content").val();
							var type=$("#tribe_type").val();
							var p=$("#slt_province").val();
							var c=$("#slt_city").val();
							var all_c=$('#all_city').attr("checked");
							var tags=$("#tags").val();
							var pms='';
							$("input[name=permission]:radio").each(function(){								
								if($(this).attr("checked")){
									 pms=$(this).attr("value");
								}
							})							
							if(title.length<5){
								alert("标题不能少于5个字");
								$("#tribe_title").trigger('focus');
								return false;
							}
							if(content.length<20){
								alert("内容不能少于20个字");
								$("#content").trigger('focus');
								return false;
							}
							if($("#tribe_type").val()==0){
								alert("请选择圈子类型");
								$("#tribe_type").trigger('focus');
								return false;
							}
							if($("#all_city").attr("checked")==false  && ($("#slt_province").val()=='' || $("#slt_city").val()=='')){
								alert('请选择地区')
								return false;
							}
							$.ajax({type:"POST",
					dataType:"json",data:{"dataFromType":"ajax","act":"set_reg_status",
							"classid":$("#classid").val(),
							"enews":"MAddInfo",
							"enews":"MAddInfo",
							"title":(title),
							"content":(content),
							"type":type,
							"province":p,
							"city":c,
							"tags":tags,
							"permission":pms
						},
					url:($("#newsurl").val())+"e/DoInfo/ecms.php",success:function(r){
					if(r.flag==1){
						popUpLoadUrl("部落图片",'add_tribe_pic',{"act":"add_tribe_pic","&tribeid":r.tribe_id},function(){
							bindBoxUpload(".select_pic",r.tribe_id);
							
						});
						return false;
					}else if(r.msg){alert(r.msg);}else{	alert("系统错误，请与管理员联系");}}});
						});
}
	 </script>
	  </div>
</div>
<?php
require(ECMS_PATH.'e/data/template/cp_2.php');
?>